package com.ld.data.config;


import com.ld.data.properties.LDProperties;
import io.minio.MinioClient;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MinioConfiguration {

    @Autowired
    private LDProperties ldProperties;

    @Bean
    @SneakyThrows
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(ldProperties.getMinio().getEndpoint())
                .credentials(ldProperties.getMinio().getAccessKey(), ldProperties.getMinio().getSecretKey())
                .build();
    }
}
